package day09;

public class CloneDemo {
    public static void main(String[] args) {
        User user1 = new User(1,"admin",13);

        UserInfo info = new UserInfo(100,"这是一个好人");

        user1.setUserInfo(info);

        try{
            User copy = (User) user1.clone();
            user1.setId(100);
            user1.setUsername("admin");

            user1.getUserInfo().setId(200);
            user1.getUserInfo().setInfo("坏人!");
            System.out.println(copy==user1);
            System.out.println(copy);
        }catch (CloneNotSupportedException e){
            e.printStackTrace();
        }
    }
}
